package com.woniu.internalcommon.remote;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.woniu.internalcommon.dto.*;
import com.woniu.internalcommon.response.DriverUserExistsResponse;
import com.woniu.internalcommon.response.OrderDriverResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "service-driver-user",path = "service-driver-user")
public interface ServiceDriverUserClient {

    /**
     * 修改司机信息
     * @param driverUser
     * @return
     */
    @RequestMapping(method = RequestMethod.PUT, value = "/driver/update")
    public ResponseResult updateDriverUser(@RequestBody DriverUser driverUser);

    /**
     * 根据手机号查询司机信息（查是否存在）
     * @param driverPhone
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/driver/selectByDriverPhone")
    public ResponseResult<DriverUserExistsResponse> selectByDriverPhone(@RequestParam("driverPhone") String driverPhone);

    /**
     * 根据手机号查询司机信息（查具体信息）
     * @param driverPhone
     * @return
     */
    @GetMapping("/getDriverUserByPhone")
    public ResponseResult<DriverUser> getDriverUserByPhone(@RequestParam("driverPhone") String driverPhone);

    /**
     * 根据carId查询车辆信息
     * @param id
     * @return
     */
    @RequestMapping(method = RequestMethod.GET, value = "/car/getCarById")
    public ResponseResult<Car> getCarById(@RequestParam("id") Long id);

    /**
     * 修改司机工作状态
     * @param driverUserWorkStatus
     * @return
     */
    @RequestMapping(method = RequestMethod.PUT, value="/workStatus/changeWorkStatus")
    public ResponseResult changeWorkStatus(@RequestBody DriverUserWorkStatus driverUserWorkStatus);

    /**
     * 根据手机号查询司机和车辆绑定关系
     * @param driverPhone
     * @return
     */
    @GetMapping("/driver/getDriverCarRelationShip")
    public ResponseResult<DriverCarBindingRelationship> getDriverCarRelationShip(@RequestParam("driverPhone") String driverPhone);

    /**
     * 根据司机id查询司机工作状态
     * @param driverId
     * @return
     */
    @GetMapping("/workStatus/selecStatustById")
    public ResponseResult<DriverUserWorkStatus> selecStatustById(@RequestParam("driverId") Long driverId);

    /**
     * 获取可用司机（这里指的是司机身份有效，而不是工作状态）
     * @param carId
     * @return
     */
    @GetMapping("/cityDriver/getAvailableDriver")
    public ResponseResult<OrderDriverResponse> getAvailableDriver(@RequestParam("carId") Long carId);

    /**
     * 新增司机
     * @param driverUser
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/driver/addDriverUser")
    public ResponseResult addDriverUser(@RequestBody DriverUser driverUser);

    /**
     * 新增车辆
     * @param car
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/car/addCar")
    public ResponseResult addCar(@RequestBody Car car);

    /**
     * 新增司机和车辆绑定关系
     * @param driverCarBindingRelationship
     * @return
     */
    @RequestMapping(method = RequestMethod.POST,value = "/bind/binding")
    public ResponseResult binding(@RequestBody DriverCarBindingRelationship driverCarBindingRelationship);

    /**
     * 解绑司机和车辆关系
     * @param driverCarBindingRelationship
     * @return
     */
    @RequestMapping(method = RequestMethod.DELETE,value = "/bind/unBinding")
    ResponseResult unBinding(@RequestBody DriverCarBindingRelationship driverCarBindingRelationship);

    /**
     * 判断城市是否有可用司机
     * @param cityCode
     * @return
     */
    @GetMapping("/cityDriver/isAvailableDriver")
    public ResponseResult<Boolean> isAlailableDriver(@RequestParam("cityCode") String cityCode);


    //此方法错误，已弃用
    @RequestMapping(method = RequestMethod.GET, value = "/check-driver/{driverPhone}")
    public ResponseResult<DriverUserExistsResponse> checkDriver(@PathVariable("driverPhone") String driverPhone);


    /**
     * 多条件查询司机
     * @param apiBossDriver
     * @return
     */
    @RequestMapping(method = RequestMethod.POST, value = "/driver/findDriver")
    public ResponseResult<Page<DriverUser>> findDriver(@RequestBody  ApiBossDriver apiBossDriver);


    /**
     * 删除司机信息
     * @param id
     * @return
     */
    @RequestMapping(method = RequestMethod.DELETE, value = "/driver/deleteById")
    public ResponseResult deleteById(Long id);

    /**
     * 查询所有
     * @param
     * @return
     */
    @GetMapping("/driver/getAll")
    public ResponseResult<Page<DriverUser>> getAll(@RequestParam("current")
                                             Integer current, @RequestParam("size") Integer size );


    /**
     *  查询所有车辆——分页+条件
     * @param apiBossCar
     * @return
     */
    @PostMapping("/car/getAllCar")
    ResponseResult<Page<Car>> getAllCar(ApiBossCar apiBossCar);
}
